package com.web.controller.web;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.web.dao.*;
import com.web.domain.dataTable.BootstrapTableColumns;
import com.web.domain.dataTable.BootstrapTableResponse;
import com.web.entity.*;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.Date;
import java.util.List;

/**
 * @author FDjavaone
 * @date 2017/10/17
 */
@Controller
@RequestMapping("syslog")
public class WebSysLogController {
    @Autowired
    private OrderRecordForPlatformMapper orderRecordForPlatformMapper;
    @Autowired
    private CompanyBonusDetailMapper companyBonusDetailMapper;
    @Autowired
    private CompanyCompanyMsDetailMapper companyCompanyMsDetailMapper;
    @Autowired
    private CompanyFundDetailMapper companyFundDetailMapper;
    @Autowired
    private CompanyMarketDetailMapper companyMarketDetailMapper;
    @Autowired
    private CompanyProfitDetailMapper companyProfitDetailMapper;
    @Autowired
    private CompanyMarketMsDetailMapper companyMarketMsDetailMapper;
    @Autowired
    private CompanyPoundageDetailMapper companyPoundageDetailMapper;

    @Autowired
    private CoreDetailMapper coreDetailMapper;
    @Autowired
    private ConsumptionDetailMapper consumptionDetailMapper;
    @Autowired
    private OriginalDetailMapper originalDetailMapper;
    @Autowired
    private ProfitDetailMapper profitDetailMapper;
    @Autowired
    private MerchantDetailMapper merchantDetailMapper;
    @Autowired
    private MskDetailMapper mskDetailMapper;

    @Autowired
    private UserAccountRecordMapper userAccountRecordMapper;

    @Autowired
    private OrderMapper orderMapper;
    @Autowired
    private OrderGoodsMapper orderGoodsMapper;


    @RequestMapping(value = "orderlog",
            method = RequestMethod.GET)
    public String orderlog(Model model, HttpServletRequest request) {
        return "orderlog";
    }

    @RequestMapping(value = "companyFund",
            method = RequestMethod.GET)
    public String companyFund(Model model, HttpServletRequest request) {
        return "companyFund";
    }

    @RequestMapping(value = "marketFund",
            method = RequestMethod.GET)
    public String marketFund(Model model, HttpServletRequest request) {
        return "marketFund";
    }

    @RequestMapping(value = "companyProfit",
            method = RequestMethod.GET)
    public String companyProfit(Model model, HttpServletRequest request) {
        return "companyProfit";
    }

    @RequestMapping(value = "companyBonus",
            method = RequestMethod.GET)
    public String companyBonus(Model model, HttpServletRequest request) {
        return "companyBonus";
    }

    @RequestMapping(value = "companyPoundage",
            method = RequestMethod.GET)
    public String companyPoundage(Model model, HttpServletRequest request) {
        return "companyPoundage";
    }

    @RequestMapping(value = "marketMs",
            method = RequestMethod.GET)
    public String marketMs(Model model, HttpServletRequest request) {
        return "marketMs";
    }

    @RequestMapping(value = "companyMs",
            method = RequestMethod.GET)
    public String companyMs(Model model, HttpServletRequest request) {
        return "companyMs";
    }

    @RequestMapping(value = "corelog",
            method = RequestMethod.GET)
    public String corelog(Model model, HttpServletRequest request) {
        return "corelogs";
    }

    @RequestMapping(value = "consumptionlog",
            method = RequestMethod.GET)
    public String consumptionlog(Model model, HttpServletRequest request) {
        return "consumptionlog";
    }

    @RequestMapping(value = "originallog",
            method = RequestMethod.GET)
    public String originallog(Model model, HttpServletRequest request) {
        return "originallog";
    }

    @RequestMapping(value = "profitlog",
            method = RequestMethod.GET)
    public String profitlog(Model model, HttpServletRequest request) {
        return "profitlog";
    }

    @RequestMapping(value = "mslog",
            method = RequestMethod.GET)
    public String mslog(Model model, HttpServletRequest request) {
        return "mslog";
    }

    @RequestMapping(value = "merchantlog",
            method = RequestMethod.GET)
    public String merchantlog(Model model, HttpServletRequest request) {
        return "merchantlog";
    }

    @RequestMapping(value = "merchantagentlog",
            method = RequestMethod.GET)
    public String merchantagentlog(Model model, HttpServletRequest request) {
        return "merchantagentlog";
    }

    @RequestMapping(value = "consume",
            method = RequestMethod.GET)
    public String consume(Model model, HttpServletRequest request) {
        return "consume";
    }

    @Data
    public static class DetailsColumns extends BootstrapTableColumns {
        private String name;
        private String phone;
        private Integer type;
        private String fromNum;
        private String store;
        private String consumer;
        @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private Date begin_createTime;
        @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private Date end_createTime;
    }


    @Data
    public static class OrderLogColumns extends BootstrapTableColumns {
        private String orderNum;
        private String consumer;
        private String merchant;
        private String store;
        private String consumerPhone;
        private String merchantPhone;
        private Long storeId;
        @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private Date begin_createTime;
        @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private Date begin_modifyTime;
        @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private Date end_createTime;
        @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private Date end_modifyTime;

    }


    @RequestMapping("/getOrderLogs")
    @ResponseBody
    public BootstrapTableResponse getOrders(OrderLogColumns orderLogColumns) {

        if (StringUtils.isNotBlank(orderLogColumns.getConsumer())) {
            orderLogColumns.setConsumer("%" + orderLogColumns.getConsumer() + "%");
        }
        if (StringUtils.isNotBlank(orderLogColumns.getMerchant())) {
            orderLogColumns.setMerchant("%" + orderLogColumns.getMerchant() + "%");
        }
        if (StringUtils.isNotBlank(orderLogColumns.getConsumerPhone())) {
            orderLogColumns.setConsumerPhone("%" + orderLogColumns.getConsumerPhone() + "%");
        }
        if (StringUtils.isNotBlank(orderLogColumns.getMerchantPhone())) {
            orderLogColumns.setMerchantPhone("%" + orderLogColumns.getMerchantPhone() + "%");
        }
        if (StringUtils.isNotBlank(orderLogColumns.getStore())) {
            orderLogColumns.setStore("%" + orderLogColumns.getStore() + "%");
        }
        PageHelper.startPage(orderLogColumns.getPageNumber(), orderLogColumns.getPageSize());
        Page<OrderRecordForPlatform> page = orderRecordForPlatformMapper.selectAllOrderLogs(orderLogColumns);
        BootstrapTableResponse bootstrapTableResponse = new BootstrapTableResponse();
        bootstrapTableResponse.setResult(page.getResult());
        bootstrapTableResponse.setTotalCount(page.getTotal());
        return bootstrapTableResponse;
    }


    @RequestMapping("/getConsumeLogs")
    @ResponseBody
    public BootstrapTableResponse getConsumeLogs(OrderLogColumns orderLogColumns) {

        if (StringUtils.isNotBlank(orderLogColumns.getConsumer())) {
            orderLogColumns.setConsumer("%" + orderLogColumns.getConsumer() + "%");
        }

        PageHelper.startPage(orderLogColumns.getPageNumber(), orderLogColumns.getPageSize());
        Page<OrderRecordForPlatform> page = orderRecordForPlatformMapper.selectAllOrderLogs(orderLogColumns);
        for (OrderRecordForPlatform orderRecordForPlatform : page.getResult()) {
            Order order = orderMapper.selectByOrderNum(orderRecordForPlatform.getOrderNum());
            //补全订单消费详情，快递单号，订单状态
            orderRecordForPlatform.setStore(order.getStatus().toString());
            if (order.getOrderType().equals("online")) {
                if (order.getExpressNumber() != null) {
                    orderRecordForPlatform.setMerchantPhone(order.getExpressNumber());
                }
                String content = "";
                List<OrderGoods> list = orderGoodsMapper.selectByOrderId(order.getId());
                for (OrderGoods o : list) {
                    content += o.getTitle() + "*" + o.getNum() + "*" + o.getPrice() + ",";
                }
                orderRecordForPlatform.setMerchant(content);

            } else {
                orderRecordForPlatform.setMerchant("直接支付");
                orderRecordForPlatform.setMerchantPhone("############");
            }

        }

        BootstrapTableResponse bootstrapTableResponse = new BootstrapTableResponse();
        bootstrapTableResponse.setResult(page.getResult());
        bootstrapTableResponse.setTotalCount(page.getTotal());
        return bootstrapTableResponse;
    }

    @RequestMapping("/getCompanyFundLogs")
    @ResponseBody
    public BootstrapTableResponse getCompanyFundLogs(DetailsColumns detailsColumns) {

        if (StringUtils.isNotBlank(detailsColumns.getName())) {
            detailsColumns.setName("%" + detailsColumns.getName() + "%");
        }
        if (StringUtils.isNotBlank(detailsColumns.getPhone())) {
            detailsColumns.setPhone("%" + detailsColumns.getPhone() + "%");
        }
        if (StringUtils.isNotBlank(detailsColumns.getFromNum())) {
            detailsColumns.setFromNum("%" + detailsColumns.getFromNum() + "%");
        }

        PageHelper.startPage(detailsColumns.getPageNumber(), detailsColumns.getPageSize());
        Page<CompanyFundDetail> page = companyFundDetailMapper.selectAllCompanyFundLogs(detailsColumns);
        BootstrapTableResponse bootstrapTableResponse = new BootstrapTableResponse();
        bootstrapTableResponse.setResult(page.getResult());
        bootstrapTableResponse.setTotalCount(page.getTotal());
        return bootstrapTableResponse;
    }

    @RequestMapping("/getMarketFundLogs")
    @ResponseBody
    public BootstrapTableResponse getMarketFundLogs(DetailsColumns detailsColumns) {

        if (StringUtils.isNotBlank(detailsColumns.getName())) {
            detailsColumns.setName("%" + detailsColumns.getName() + "%");
        }
        if (StringUtils.isNotBlank(detailsColumns.getPhone())) {
            detailsColumns.setPhone("%" + detailsColumns.getPhone() + "%");
        }
        if (StringUtils.isNotBlank(detailsColumns.getFromNum())) {
            detailsColumns.setFromNum("%" + detailsColumns.getFromNum() + "%");
        }

        PageHelper.startPage(detailsColumns.getPageNumber(), detailsColumns.getPageSize());
        Page<CompanyMarketDetail> page = companyMarketDetailMapper.selectAllCompanyMarketLogs(detailsColumns);
        BootstrapTableResponse bootstrapTableResponse = new BootstrapTableResponse();
        bootstrapTableResponse.setResult(page.getResult());
        bootstrapTableResponse.setTotalCount(page.getTotal());
        return bootstrapTableResponse;
    }

    @RequestMapping("/getCompanyProfitLogs")
    @ResponseBody
    public BootstrapTableResponse getCompanyProfitLogs(DetailsColumns detailsColumns) {

        if (StringUtils.isNotBlank(detailsColumns.getName())) {
            detailsColumns.setName("%" + detailsColumns.getName() + "%");
        }
        if (StringUtils.isNotBlank(detailsColumns.getPhone())) {
            detailsColumns.setPhone("%" + detailsColumns.getPhone() + "%");
        }
        if (StringUtils.isNotBlank(detailsColumns.getFromNum())) {
            detailsColumns.setFromNum("%" + detailsColumns.getFromNum() + "%");
        }

        PageHelper.startPage(detailsColumns.getPageNumber(), detailsColumns.getPageSize());
        Page<CompanyProfitDetail> page = companyProfitDetailMapper.selectAllCompanyProfitLogs(detailsColumns);
        BootstrapTableResponse bootstrapTableResponse = new BootstrapTableResponse();
        bootstrapTableResponse.setResult(page.getResult());
        bootstrapTableResponse.setTotalCount(page.getTotal());
        return bootstrapTableResponse;
    }

    @RequestMapping("/getCompanyBonusLogs")
    @ResponseBody
    public BootstrapTableResponse getCompanyBonusLogs(DetailsColumns detailsColumns) {

        if (StringUtils.isNotBlank(detailsColumns.getName())) {
            detailsColumns.setName("%" + detailsColumns.getName() + "%");
        }
        if (StringUtils.isNotBlank(detailsColumns.getPhone())) {
            detailsColumns.setPhone("%" + detailsColumns.getPhone() + "%");
        }
        if (StringUtils.isNotBlank(detailsColumns.getFromNum())) {
            detailsColumns.setFromNum("%" + detailsColumns.getFromNum() + "%");
        }

        PageHelper.startPage(detailsColumns.getPageNumber(), detailsColumns.getPageSize());
        Page<CompanyBonusDetail> page = companyBonusDetailMapper.selectAllCompanyBonusLogs(detailsColumns);
        BootstrapTableResponse bootstrapTableResponse = new BootstrapTableResponse();
        bootstrapTableResponse.setResult(page.getResult());
        bootstrapTableResponse.setTotalCount(page.getTotal());
        return bootstrapTableResponse;
    }

    @RequestMapping("/getCompanyPoundageLogs")
    @ResponseBody
    public BootstrapTableResponse getCompanyPoundageLogs(DetailsColumns detailsColumns) {

        if (StringUtils.isNotBlank(detailsColumns.getName())) {
            detailsColumns.setName("%" + detailsColumns.getName() + "%");
        }
        if (StringUtils.isNotBlank(detailsColumns.getPhone())) {
            detailsColumns.setPhone("%" + detailsColumns.getPhone() + "%");
        }
        if (StringUtils.isNotBlank(detailsColumns.getFromNum())) {
            detailsColumns.setFromNum("%" + detailsColumns.getFromNum() + "%");
        }

        PageHelper.startPage(detailsColumns.getPageNumber(), detailsColumns.getPageSize());
        Page<CompanyPoundageDetail> page = companyPoundageDetailMapper.selectAllCompanyPoundageLogs(detailsColumns);
        BootstrapTableResponse bootstrapTableResponse = new BootstrapTableResponse();
        bootstrapTableResponse.setResult(page.getResult());
        bootstrapTableResponse.setTotalCount(page.getTotal());
        return bootstrapTableResponse;
    }

    @RequestMapping("/getCompanyCompanyMsLogs")
    @ResponseBody
    public BootstrapTableResponse getCompanyCompanyMsLogs(DetailsColumns detailsColumns) {

        if (StringUtils.isNotBlank(detailsColumns.getName())) {
            detailsColumns.setName("%" + detailsColumns.getName() + "%");
        }
        if (StringUtils.isNotBlank(detailsColumns.getPhone())) {
            detailsColumns.setPhone("%" + detailsColumns.getPhone() + "%");
        }
        if (StringUtils.isNotBlank(detailsColumns.getFromNum())) {
            detailsColumns.setFromNum("%" + detailsColumns.getFromNum() + "%");
        }

        PageHelper.startPage(detailsColumns.getPageNumber(), detailsColumns.getPageSize());
        Page<CompanyCompanyMsDetail> page = companyCompanyMsDetailMapper.selectAllCompanyMsLogs(detailsColumns);
        BootstrapTableResponse bootstrapTableResponse = new BootstrapTableResponse();
        bootstrapTableResponse.setResult(page.getResult());
        bootstrapTableResponse.setTotalCount(page.getTotal());
        return bootstrapTableResponse;
    }

    @RequestMapping("/getCompanyMarketMsLogs")
    @ResponseBody
    public BootstrapTableResponse getCompanyMarketMsLogs(DetailsColumns detailsColumns) {

        if (StringUtils.isNotBlank(detailsColumns.getName())) {
            detailsColumns.setName("%" + detailsColumns.getName() + "%");
        }
        if (StringUtils.isNotBlank(detailsColumns.getPhone())) {
            detailsColumns.setPhone("%" + detailsColumns.getPhone() + "%");
        }
        if (StringUtils.isNotBlank(detailsColumns.getFromNum())) {
            detailsColumns.setFromNum("%" + detailsColumns.getFromNum() + "%");
        }

        PageHelper.startPage(detailsColumns.getPageNumber(), detailsColumns.getPageSize());
        Page<CompanyMarketMsDetail> page = companyMarketMsDetailMapper.selectAllCompanyMarketMsLogs(detailsColumns);
        BootstrapTableResponse bootstrapTableResponse = new BootstrapTableResponse();
        bootstrapTableResponse.setResult(page.getResult());
        bootstrapTableResponse.setTotalCount(page.getTotal());
        return bootstrapTableResponse;
    }


    @RequestMapping("/getCoreLogs")
    @ResponseBody
    public BootstrapTableResponse getCoreLogs(DetailsColumns detailsColumns) {

        if (StringUtils.isNotBlank(detailsColumns.getName())) {
            detailsColumns.setName("%" + detailsColumns.getName() + "%");
        }
        if (StringUtils.isNotBlank(detailsColumns.getPhone())) {
            detailsColumns.setPhone("%" + detailsColumns.getPhone() + "%");
        }
        if (StringUtils.isNotBlank(detailsColumns.getFromNum())) {
            detailsColumns.setFromNum("%" + detailsColumns.getFromNum() + "%");
        }

        PageHelper.startPage(detailsColumns.getPageNumber(), detailsColumns.getPageSize());
        Page<CoreDetail> page = coreDetailMapper.selectAllCoreLogs(detailsColumns);
        BootstrapTableResponse bootstrapTableResponse = new BootstrapTableResponse();
        bootstrapTableResponse.setResult(page.getResult());
        bootstrapTableResponse.setTotalCount(page.getTotal());
        return bootstrapTableResponse;
    }

    @RequestMapping("/getConsumptionLogs")
    @ResponseBody
    public BootstrapTableResponse getConsumtionLogs(DetailsColumns detailsColumns) {

        if (StringUtils.isNotBlank(detailsColumns.getName())) {
            detailsColumns.setName("%" + detailsColumns.getName() + "%");
        }
        if (StringUtils.isNotBlank(detailsColumns.getPhone())) {
            detailsColumns.setPhone("%" + detailsColumns.getPhone() + "%");
        }
        if (StringUtils.isNotBlank(detailsColumns.getFromNum())) {
            detailsColumns.setFromNum("%" + detailsColumns.getFromNum() + "%");
        }

        PageHelper.startPage(detailsColumns.getPageNumber(), detailsColumns.getPageSize());
        Page<ConsumptionDetail> page = consumptionDetailMapper.selectAllConsumptionLogs(detailsColumns);
        BootstrapTableResponse bootstrapTableResponse = new BootstrapTableResponse();
        bootstrapTableResponse.setResult(page.getResult());
        bootstrapTableResponse.setTotalCount(page.getTotal());
        return bootstrapTableResponse;
    }

    @RequestMapping("/getOriginalLogs")
    @ResponseBody
    public BootstrapTableResponse getOriginalLogs(DetailsColumns detailsColumns) {

        if (StringUtils.isNotBlank(detailsColumns.getName())) {
            detailsColumns.setName("%" + detailsColumns.getName() + "%");
        }
        if (StringUtils.isNotBlank(detailsColumns.getPhone())) {
            detailsColumns.setPhone("%" + detailsColumns.getPhone() + "%");
        }
        if (StringUtils.isNotBlank(detailsColumns.getFromNum())) {
            detailsColumns.setFromNum("%" + detailsColumns.getFromNum() + "%");
        }

        PageHelper.startPage(detailsColumns.getPageNumber(), detailsColumns.getPageSize());
        Page<OriginalDetail> page = originalDetailMapper.selectAllOriginalLogs(detailsColumns);
        BootstrapTableResponse bootstrapTableResponse = new BootstrapTableResponse();
        bootstrapTableResponse.setResult(page.getResult());
        bootstrapTableResponse.setTotalCount(page.getTotal());
        return bootstrapTableResponse;
    }

    @RequestMapping("/getProfitLogs")
    @ResponseBody
    public BootstrapTableResponse getProfitLogs(DetailsColumns detailsColumns) {

        if (StringUtils.isNotBlank(detailsColumns.getName())) {
            detailsColumns.setName("%" + detailsColumns.getName() + "%");
        }
        if (StringUtils.isNotBlank(detailsColumns.getPhone())) {
            detailsColumns.setPhone("%" + detailsColumns.getPhone() + "%");
        }
        if (StringUtils.isNotBlank(detailsColumns.getFromNum())) {
            detailsColumns.setFromNum("%" + detailsColumns.getFromNum() + "%");
        }

        PageHelper.startPage(detailsColumns.getPageNumber(), detailsColumns.getPageSize());
        Page<ProfitDetail> page = profitDetailMapper.selectAllProfitLogs(detailsColumns);
        BootstrapTableResponse bootstrapTableResponse = new BootstrapTableResponse();
        bootstrapTableResponse.setResult(page.getResult());
        bootstrapTableResponse.setTotalCount(page.getTotal());
        return bootstrapTableResponse;
    }

    @RequestMapping("/getMerchantLogs")
    @ResponseBody
    public BootstrapTableResponse getMerchantLogs(DetailsColumns detailsColumns) {

        if (StringUtils.isNotBlank(detailsColumns.getName())) {
            detailsColumns.setName("%" + detailsColumns.getName() + "%");
        }
        if (StringUtils.isNotBlank(detailsColumns.getPhone())) {
            detailsColumns.setPhone("%" + detailsColumns.getPhone() + "%");
        }
        if (StringUtils.isNotBlank(detailsColumns.getFromNum())) {
            detailsColumns.setFromNum("%" + detailsColumns.getFromNum() + "%");
        }
        if (StringUtils.isNotBlank(detailsColumns.getStore())) {
            detailsColumns.setStore("%" + detailsColumns.getStore() + "%");
        }
        if (StringUtils.isNotBlank(detailsColumns.getConsumer())) {
            detailsColumns.setConsumer("%" + detailsColumns.getConsumer() + "%");
        }

        PageHelper.startPage(detailsColumns.getPageNumber(), detailsColumns.getPageSize());
        Page<MerchantDetail> page = merchantDetailMapper.selectAllMerchantLogs(detailsColumns);
        BootstrapTableResponse bootstrapTableResponse = new BootstrapTableResponse();
        bootstrapTableResponse.setResult(page.getResult());
        bootstrapTableResponse.setTotalCount(page.getTotal());
        return bootstrapTableResponse;
    }

    @RequestMapping("/getMsLogs")
    @ResponseBody
    public BootstrapTableResponse getMsLogs(DetailsColumns detailsColumns) {

        if (StringUtils.isNotBlank(detailsColumns.getName())) {
            detailsColumns.setName("%" + detailsColumns.getName() + "%");
        }
        if (StringUtils.isNotBlank(detailsColumns.getPhone())) {
            detailsColumns.setPhone("%" + detailsColumns.getPhone() + "%");
        }

        PageHelper.startPage(detailsColumns.getPageNumber(), detailsColumns.getPageSize());
        Page<MskDetail> page = mskDetailMapper.selectAllMsLogs(detailsColumns);
        BootstrapTableResponse bootstrapTableResponse = new BootstrapTableResponse();
        bootstrapTableResponse.setResult(page.getResult());
        bootstrapTableResponse.setTotalCount(page.getTotal());
        return bootstrapTableResponse;
    }

    @RequestMapping("/getMerchantAgentLogs")
    @ResponseBody
    public BootstrapTableResponse getMerchantAgentLogs(DetailsColumns detailsColumns) {

        if (StringUtils.isNotBlank(detailsColumns.getName())) {
            detailsColumns.setName("%" + detailsColumns.getName() + "%");
        }
        if (StringUtils.isNotBlank(detailsColumns.getPhone())) {
            detailsColumns.setPhone("%" + detailsColumns.getPhone() + "%");
        }
        if (StringUtils.isNotBlank(detailsColumns.getFromNum())) {
            detailsColumns.setFromNum("%" + detailsColumns.getFromNum() + "%");
        }

        PageHelper.startPage(detailsColumns.getPageNumber(), detailsColumns.getPageSize());
        Page<UserAccountRecord> page = userAccountRecordMapper.selectAllMerchantAgentLogs(detailsColumns);
        BootstrapTableResponse bootstrapTableResponse = new BootstrapTableResponse();
        bootstrapTableResponse.setResult(page.getResult());
        bootstrapTableResponse.setTotalCount(page.getTotal());
        return bootstrapTableResponse;
    }
}
